package com.cgs.springboottes2secrity.sec;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author cgs
 * @version woNiu 98
 * @date 2023/5/12 15:22
 */
public class JwtToken extends AbstractAuthenticationToken {
    private String jwt;

    /**
     * Creates a token with the supplied array of authorities.
     *
     * @param authorities the collection of <tt>GrantedAuthority</tt>s for the principal
     *                    represented by this authentication object.
     */
    public JwtToken(Collection<? extends GrantedAuthority> authorities,String jwt) {
        super(authorities);
        this.jwt=jwt;
    }

    @Override
    public Object getCredentials() {
        return jwt;
    }

    @Override
    public Object getPrincipal() {
        return jwt;
    }
}
